package cn.itsource.pethome_0310.org.domain;

import cn.itsource.pethome_0310.basic.base.MyBaseDomain;
import cn.itsource.pethome_0310.util.BaseTreeNode;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;

@Data

@Table(name = "t_department")
public class Department extends BaseTreeNode<Department> implements MyBaseDomain {

    /*主键*/
    @Id
    @GeneratedValue(generator = "JDBC")
    private Long id;
    /*部门编号*/
    @NotNull(message = "请输入部门编号")
    @NotBlank(message = "请输入部门编号")
    private String sn;
    /*部门名称*/
    @NotNull(message = "请输入部门名称")
    @NotBlank(message = "请输入部门名称")
    private String name;
    /*暂时不用*/
    private String dirPath;
    /*部门状态 0 正常 ，-1 停用*/
    private int state;

    private Long parentId;
    /**
     * 部门经理名称
     */
    @Transient
    private String manager;

    private Long managerId;
    /**
     * 上级部门名称
     */
    @Transient
    private String parent;
    /**
     *
     */
    @Transient
    private List<Department> children;
    //标识是否为删除
    private Boolean del;
    
    // 无需再写getter和setter方法
/****************************************************
*
*
*下面是自定义的构造方法
****************************************************/
    public Department(Long id ,String name){
        this.id = id;
        this.name = name;

    }
    public Department(){

    }

    public Department(Long id, Boolean aFalse) {
        this.id = id;
        this.del = aFalse;
    }
}